function yerefresh(){
    location.reload(true);
}
function hide(){
    if($("#searchheader").css("display")=="none"){
        $("#searchheader").css("display","block");
        $("#hide").text("收起筛选")
    }else if($("#searchheader").css("display")=="block"){
        $("#searchheader").css("display","none");
        $("#hide").text("打开筛选")
    }
}
function dsh(){
    $("#ysj").css("background-color","");
    $("#qbkc").css("background-color","pink");
    layui.use('table', function () {
        $("#mark").val(1);
        var table=layui.table;
        table.reload('demo',{
            where:{
                mark:1
            }
        })
    })
}
function ycl(){
    $("#qbkc").css("background-color","");
    $("#ysj").css("background-color","purple");
    layui.use('table', function () {
        $("#mark").val(2);
        var table=layui.table;
        table.reload('demo',{
            where:{
                mark:2
            }
        })
    })
}
function aa(res) {
    if(res==0){
        return '很好';
    }else if(res==1){
        return '一般';
    }else if(res==2){
        return '不好';
    }
}
function bb(res) {
    if(res==0){
        return '视频反馈';
    }else if(res==1){
        return '商品反馈';
    }else if(res===2){
        return '其他反馈';
    }
}
function refresh1() {
    tableIn.reload("demo");
}
var tableIn=null;
var kcname=null;
var title1=null;
var data1=null;
$.ajax({
    type:'post',
    url: '/advanced/selectfeedbackstate',
    success:function(res){
        $("#selectdsh").text(res.selectdsh);
        $("#selectycl").text(res.selectycl);
    }
})
    layui.use(['table','dropdown','form'], function () {
        var form=layui.form
        var dropdown = layui.dropdown
        var table = layui.table;
        var opinionclass=null;
        var laydate = layui.laydate;
        laydate.render({
            elem: '#date'
        });
        form.on('select(opinionclass)', function (data) {
            console.log(data)
            opinionclass= data.value;
        });
        var feedbacktype=null;
        form.on('select(feedbacktype)', function (data) {
            console.log(data)
            feedbacktype= data.value;
        });
        table.on('tool(test)', function(obj){
            var data = obj.data;
            var layEvent = obj.event;
            var tr = obj.tr;
            if(layEvent === 'sl'){
                localStorage.setItem("slid",obj.data.id)
                layer.open({
                    type: 2,
                    title: '查看课程',
                    content: "acceptfeedback.html",
                    area: ['80%', '80%'],
                })
            }
        });
        //第一个实例
        tableIn = table.render({
            elem: '#demo'
            , height: 800
            , id: 'demo'
            , url: '/advanced/getfeedbacklist' //数据接口
            , page: true //开启分页
            , cols: [[ //表头
                {type: 'checkbox', fixed: 'left'},
                {field: 'id', title: '序号'},
                {field: 'useraccount',title: '用户账号'},
                {field: 'feedbacktype',title: '意见反馈类型',
                    templet: function (d) {return aa(d.feedbacktype)}},
                {field: 'opinionclass',title: '意见分类',
                    templet: function (d) {return bb(d.opinionclass)}},
                {field: 'feedbacktime',title: '反馈时间'},
                {field: 'feedbackcontent',title: '反馈内容'},
                {title: '操作',width:150, toolbar: '#barDemo'}
            ]],
            parseData: function (res) { //res 即为原始返回的数据
                return {
                    "code": res.state, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.total, //解析数据长度
                    "data": res.data //解析数据列表
                };
            },
        });
        $("#selectkc").click(function(){
            useraccount=$("#useraccount").val();
            var createtime =$("#date").val();
            table.reload('demo',{
                where:{
                    useraccount:useraccount,
                    opinionclass:opinionclass,
                    feedbacktype:feedbacktype,
                    time:createtime
                }
            })
        })
    });
